{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>向导图列表</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <ul onclick="view(this)" id="view_{{d.tan_id}}">
                            <li><img data-original="{{d.tan_image}}" src="{{d.tan_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  /></li>
                        </ul>
                    </script>
                    <!--角色模板-->
                    <script type="text/html" id="titleTpl">
                        {{# if(d.tan_id == 1){ }}
                        用户端
                        {{# }else if(d.tan_id == 2){ }}
                        商户端
                        {{# }else if(d.tan_id == 3){ }}
                        业务端
                        {{# }else if(d.tan_id == 4){ }}
                        首页图
                        {{# }else if(d.tan_id == 5){ }}
                        微信首页图
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;"onclick="wk.layer_show('编辑向导图','{:url('tanEdit')}?id={{d.tan_id}}',900)" class="btn btn-primary btn-xs m-r-xs" title="编辑"><i class="fa fa-pencil"></i></a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Tan/index")}'
            , page: false
            , even: false //开启隔行背景
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            // ,width:100
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                , {field: 'tan_id', width: '', title: '使用端', align: 'center', templet: '#titleTpl'}
                , {field: 'tan_image', width: '', title: '图片', align: 'center', templet: '#imgTpl'}
                , {field: 'tan_update_time', width: '', title: '修改时间', align: 'center'}
                , {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $.each(res.data,function(index,item){
                    $('#view_'+item['tan_id']).viewer({
                        url: 'data-original',
                    });
                });
            }
        });
    });
</script>
</body>
</html>